﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAL;
using System.Configuration;

namespace AdminSite.Pages.Deals
{
    public partial class EditComments : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                GrupyzEntities gr = new GrupyzEntities();
                Comentario com = new Comentario();
                com.Texto = txtComment.Text;
                com.IsAdmin = true;
                com.ClienteId = int.Parse(ConfigurationManager.AppSettings["AdminID"]);
                com.DealId = int.Parse(Request.QueryString["id"]);
                com.Data = DateTime.Now;

                gr.Comentario.AddObject(com);
                gr.SaveChanges();

                Page.Response.Redirect(Page.Request.Url.ToString(), true);
            }
            catch (Exception)
            {
                throw;
            }

        }
    }
}